﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Spelprojekt.Model;

namespace Spelprojekt.View
{
    class MenuView
    {

        public void Draw(Spelprojekt.Model.Menu a_menu, SpriteBatch spriteBatch, GameAssets a_assets)
        {
            DrawBackground(spriteBatch, a_assets);

            DrawButtons(a_menu, spriteBatch, a_assets);
        }

        public void DrawButtons(Spelprojekt.Model.Menu a_menu, SpriteBatch spriteBatch, GameAssets a_assets)
        {
            spriteBatch.Begin();

            foreach (Button button in a_menu.m_buttons)
            {
                //draw background
                spriteBatch.Draw(a_assets.m_whiteBox, button.m_rectangle, Color.White);

                //draw text
                spriteBatch.DrawString(a_assets.m_font,
                                       button.m_text,
                                       new Vector2(button.m_rectangle.Left, button.m_rectangle.Top),
                                       Color.Red);
            }

            spriteBatch.End();
        }

        public void DrawBackground(SpriteBatch spriteBatch, GameAssets a_assets)
        {
            spriteBatch.Begin();

            //draw background
            spriteBatch.Draw(a_assets.m_background, new Rectangle(0, 0, 1280, 720), Color.White);

            spriteBatch.End();
        }
    }
}
